#
# Copyright 2011-2015 Jeff Bush
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#include "asm_macros.h"

#
# Tests all alignments of reading and writing, across multiple cache lines by
# performing a bytewise memory copy.
#

            .globl _start
_start:     lea s1, sourceData
            lea s0, destData
            move s2, 128
loop:       load_u8 s3, (s1)
            store_8 s3, (s0)
            add_i s0, s0, 1
            add_i s1, s1, 1
            sub_i s2, s2, 1
            bnz s2, loop

            halt_current_thread

sourceData: .byte 0x17, 0x64, 0xda, 0x1b, 0x7f, 0xba, 0x7a, 0x6b, 0x25, 0x4f, 0x20, 0x76, 0x5b, 0xc5, 0xfe, 0xb4, 0xb6
            .byte 0x48, 0x98, 0x52, 0x49, 0x45, 0x61, 0x6, 0xa3, 0x85, 0xf9, 0xbd, 0x5, 0x37, 0x68, 0xc4, 0x54, 0xb4
            .byte 0x23, 0x9d, 0xd3, 0x55, 0xb5, 0x6e, 0x87, 0x45, 0x41, 0xbf, 0xde, 0x9, 0xb, 0x93, 0x96, 0xb1, 0xc9
            .byte 0xf9, 0xf0, 0x5e, 0x37, 0xb6, 0xb2, 0xac, 0xcd, 0x71, 0xc7, 0x7b, 0xd6, 0x92, 0x5a, 0x1c, 0xb7, 0x55
            .byte 0x71, 0xb9, 0xad, 0x89, 0xc5, 0xcc, 0x98, 0xd8, 0xf, 0xa1, 0x85, 0x87, 0xc, 0xbe, 0xc2, 0x37, 0x12
            .byte 0x4e, 0xee, 0x96, 0xd, 0x5e, 0xe1, 0xa, 0x5f, 0x56, 0x5b, 0x1b, 0x4, 0x2f, 0x45, 0x36, 0xa6, 0xca
            .byte 0xd0, 0x1d, 0xde, 0x1e, 0x34, 0x7, 0xe5, 0xf1, 0x41, 0xa7, 0x6f, 0x84, 0x97, 0x30, 0x96, 0x34, 0x99
            .byte 0xcb, 0x63, 0x4a, 0xc8, 0x76, 0x91, 0x31, 0x2, 0x47

destData:    .byte 0 # ...
